package com.example.mybatisplusdemo.service.impl;

import com.example.mybatisplusdemo.model.domain.Rating;
import com.example.mybatisplusdemo.mapper.RatingMapper;
import com.example.mybatisplusdemo.model.dto.StarCountDTO;
import com.example.mybatisplusdemo.service.IRatingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lxp
 * @since 2025-07-04
 */
@Service
public class RatingServiceImpl extends ServiceImpl<RatingMapper, Rating> implements IRatingService {
    @Autowired
    private RatingMapper ratingMapper;

    @Override
    public void deleteByReviewId(Long reviewId) {
        ratingMapper.deleteByReviewId(reviewId);
    }

    @Override
    public List<StarCountDTO> getRatingDistribution() {
        return ratingMapper.getRatingDistribution();
    }
}
